﻿<?php

$query = 'CREATE DATABASE ' . DB_DATABASE . ' CHARACTER SET utf8 COLLATE utf8_general_ci';
mysql_query($query);
mysql_select_db(DB_DATABASE);

$query = "CREATE TABLE users (";
$query .= "userName VARCHAR(20),";
$query .= "password VARCHAR(20),";
$query .= "karma FLOAT(5),";
$query .= "karmaTime INT(20),";
$query .= "fName VARCHAR(128),";
$query .= "lName VARCHAR(128),";
$query .= "id INT UNSIGNED NOT NULL AUTO_INCREMENT KEY) ENGINE MyISAM";
mysql_query($query);

$query = "CREATE TABLE articles (";
$query .= "userID VARCHAR(20),";
$query .= "subject VARCHAR(128),";
$query .= "tags VARCHAR(128),";
$query .= "text TEXT,";
$query .= "time TIMESTAMP,";
$query .= "id INT UNSIGNED NOT NULL AUTO_INCREMENT KEY) ENGINE MyISAM";
mysql_query($query);

$query = "CREATE TABLE comments (";
$query .= "userID VARCHAR(20),";
$query .= "artID VARCHAR(20),";
$query .= "text TEXT,";
$query .= "time TIMESTAMP,";
$query .= "id INT UNSIGNED NOT NULL AUTO_INCREMENT KEY) ENGINE MyISAM";
mysql_query($query);
?>